
<link rel="stylesheet" href="webjars/bootstrap/3.4.1/dist/css/bootstrap.min.css">
<script src="webjars/jquery/3.6.0/dist/jquery.min.js"></script>
<script src="webjars/bootstrap/3.4.1/dist/js/bootstrap.min.js"></script>

<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>我的购物车</title>
    <style>
        .container{
            margin-top: 20px;
        }
        .table{
            text-align: center;
        }
    </style>
</head>
<body>

<div class="container">
    <div class="panel panel-primary">
        <!-- Default panel contents -->
        <div class="panel-heading">已买商品</div>
        <table class="table table-bordered table-striped table-hover">
            <tr>
                <td>商品ID</td>
                <td>商品名称</td>
                <td>商品单价</td>
                <td>商品数量</td>
                <td>小计</td>
                <td>操作</td>
            </tr
            <c:forEach items="${cart.map}" var="p">
                <tr>
                    <td>${p.value.product.pid}</td>
                    <td>${p.value.product.pname}</td>
                    <td>${p.value.product.price}</td>
                    <td>${p.value.num}</td>
                    <td>${p.value.total}</td>
                    <td>
                        <a href="<c:url value="/cart?cmd=remove&pid=${p.value.product.pid}"/>"  class="btn btn-danger btn-sm" >移除</a>
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <td colspan="6">
                    <a href="/" class="btn btn-primary btn-sm">继续购物</a>
                    <a href="/cart?cmd=clear" class="btn btn-warning btn-sm">清空购物车</a>
                </td>
            </tr>
        </table>
    </div>
</div>

</body>
</html>
